﻿namespace WebPacker.Logger
{
	using System;

	public static class LoggerExtensions
	{
		public static void Exception(this ILogger logger, string message, Exception exception)
		{
			logger.LogException(LogLevel.Error, () => message, exception);
		}

		public static void Error(this ILogger logger, LogMessageBuilder messageBuilder)
		{
			logger.Log(LogLevel.Error, messageBuilder);
		}

		public static void Warn(this ILogger logger, LogMessageBuilder messageBuilder)
		{
			logger.Log(LogLevel.Warning, messageBuilder);
		}

		public static void Info(this ILogger logger, LogMessageBuilder messageBuilder)
		{
			logger.Log(LogLevel.Information, messageBuilder);
		}

		public static void Debug(this ILogger logger, LogMessageBuilder messageBuilder)
		{
			logger.Log(LogLevel.Debug, messageBuilder);
		}

		public static void Error(this ILogger logger, string message, params object[] args)
		{
			logger.Error(() => string.Format(message, args));
		}

		public static void Warn(this ILogger logger, string message, params object[] args)
		{
			logger.Warn(() => string.Format(message, args));
		}

		public static void Info(this ILogger logger, string message, params object[] args)
		{
			logger.Info(() => string.Format(message, args));
		}

		public static void Debug(this ILogger logger, string message, params object[] args)
		{
			logger.Debug(() => string.Format(message, args));
		}
	}
}
